<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
		<title>{:C('WEB_SITE_TITLE')}</title>
		<link rel="stylesheet" href="__PUBLIC__/Home/css/common.css">
		<link rel="stylesheet" href="__PUBLIC__/Home/css/main.css">
		<script src="__PUBLIC__/Home/js/zepto.js"></script>
		<script src="__PUBLIC__/Home/js/iscroll-probe.js"></script>
		<script src="__PUBLIC__/Home/js/delIOS_huitan.js"></script>
		<style>
			/*下拉加载样式*/
			#wrapper {
				position: absolute;
				z-index: 1;
				top: 100px;
				bottom: 0;
				left: 0;
				width: 100%;
				overflow: hidden;
			}
			#wrapper .ullist1line li{padding: 0}
			#loadBin{color: #5d5d5d;text-align: center;line-height: 30px;}
		</style>
	</head>
	<body onLoad="onload()" class="box">
		<!--正文区域-->
		<div id="myTuiPeopleTop" class="topBackTitle">
			<div class="contain maxWidth">
				<a class="hz back" href="javascript:;">&#xe600;</a>我的小组
			</div>
		</div>
		<div id="myTuiPeopleMain" class="fastscroll top50bot0">
			<div class="contain maxWidth">
				<ul class="ullist1line">
					<li>我的佣金：{$user.jie_money}</li>
					<!-- <li>
						<div class="left">账号</div>
						<div class="right"><if condition="$spread.regist_type eq 2">{$spread.name}<else/>{$spread.login_user}</if></div>
					</li> -->
				</ul>
				<!-- <div class="title">
					<div class="left">
						<img src="__PUBLIC__/Home/img/left.jpg">
					</div>
					<div class="center">
						<p class="tit">已推广会员</p>
						<p class="num">共<span>{:count($userlist)}</span>人</p>
						<p class="icon"><span class="hz">&#xe60b;</span></p>
					</div>
					<div class="right">
						<img src="__PUBLIC__/Home/img/right.jpg">
					</div>
				</div> -->
				<ul class="wraptit clear">
					<li>用户名</li>   
					<li>佣金金额</li>
					<li>分佣时间</li>
				</ul>
				<div id="wrapper">
					<div class="maxWidth">
						<ul class="list ullist1line tuiguang">
						<volist name="list" id="item">
							<li class="clear">
								<div class="wrapOne">{$item.spread|default="dfs"}</div>
								<div class="wrapTwo">{$item.money}</div>
								<div class="wrapThree">{:date('Y-m-d',$item['addtime'])}</div>
							</li>
						</volist>
						</ul>
						<div class="noData" style="display:none"></div>
						<div id="loadBin"></div>
					</div>
				</div>
			</div>
		</div>
		<script>
			//返回按钮
			$('#myTuiPeopleTop .back').on('tap',function(){
				window.history.go(-1);
			});

			//电话号码处理成，带有*****
			var alltel=$('#myTuiPeopleMain .ullist1line li .right');
			for(var i=0;i<alltel.length;i++){
				var str=alltel[i].innerHTML;
				var reg=/(\d{3})(\d{5})(\d{3})/;
				alltel[i].innerHTML=str.replace(reg,'$1*****$3');
			}

			//推广会员 个数总计
			var sumNum=$('#myTuiPeopleMain .tuiguang li').length;
			$('#myTuiPeopleMain .title .center .num span').text(sumNum);

			//iscroll 下拉加载+zeptoajax
			function onload(){
				loadBin = document.getElementById("loadBin");
				myScroll = new IScroll('#wrapper',{
					probeType: 3,
					click:true
				});
				myScroll.on("scroll",scrollFun);
				myScroll.on("scrollEnd",scrollEndFun);
			}
			var page=2;
			var myScroll,
				loadBin,
				isload = false,
				scrollFun = function(){
					if((this.y - this.maxScrollY)>>0 < -50){
						isload = true;
						loadBin.innerHTML = "松开手指加载更多";
						myScroll.refresh();
						myScroll.off("scroll",scrollFun);
					}
				},
				scrollEndFun = function(){
					if(isload){
						isload = false;

						 $.ajax({
						 	type: 'GET',
						 	url: "{:U('Spread/ajaxGetlist')}",
						 	dataType: 'json',
							data:{page:page},
						 	success: function(data){
								if(data!=''){
									page++;
									var str='';
									for(var i=0;i<data.length;i++){
										str+='<li class="clear">\
											<div class="wrapOne">'+data[i].showname+'</div>\
											<div class="wrapTwo">'+data[i].time+'</div>\
											<div class="wrapThree">'+data[i].card_num+'</div>\
										</li>';
									}
									$('#wrapper .list').append(str);
								}else{
									//没有更多数据了
									$('.noData').text('没有更多数据了').show();
									scrollFun = function(){
										isload = true;
										myScroll.refresh();
										myScroll.off("scroll",scrollFun);
									}
								}

								loadBin.innerHTML = "";
								myScroll.on("scroll",scrollFun);
								myScroll.refresh();
						 	},
						 	error: function(xhr, type){
						 		console.log('Ajax error!');
						 	}
						 });
					}
				};
		</script>
	</body>
</html>